<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>权限列表</title>
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
    <script src="/js/vue.js"></script>
    <script src="https://unpkg.com/element-ui/lib/index.js"></script>
    <script src="/js/jquery-3.1.1.min.js"></script>
    <script src="/js/myhttp.js"></script>
</head>
<body>
<div id="app">
    <el-form :inline="true" class="demo-form-inline" >
        <el-form-item >
            <el-button type="success" @click="QueryData()">刷新</el-button>
        </el-form-item>
    </el-form>

    <el-table border :data="dataList" style="width:100%">
        <el-table-column label="反馈标题" prop="title"></el-table-column>
        <el-table-column label="反馈内容" prop="details"></el-table-column>
        <el-table-column label="管理员回复" prop="answer"></el-table-column>
        <el-table-column>
            <template slot-scope="x">
                <el-button type="warning" size="mini" @click="Update(x.$index,x.row)">回复</el-button>
            </template>
        </el-table-column>
    </el-table>

    <el-dialog :visible.sync="Updateing" width="30%" title="回复反馈">
        <el-form label-width="80px">
            <el-form-item label="回复信息">
                <el-input v-model="select.answer"></el-input>
            </el-form-item>
            <el-form-item >
                <el-button type="success" size="mini" @click="SubmitUpdate()" >保存</el-button>
            </el-form-item>
        </el-form>
    </el-dialog>
</div>
</body>
<script>
    new Vue({
        el:"#app",
        data: {
            Createing:false,
            Updateing:false,
            dataList:[],
            news:{},
            select:{},
            querys:""
        },
        methods:{
            SubmitUpdate(){
                let that=this
                myhttps("/Callback/update",
                    that.select
                ).then(res=>{
                    that.$message.success("成功")
                    that.select = {}
                    that.Updateing = false
                }).catch(res=>{
                    that.$message.error("错误"+res.msg)
                })
            },
            InsertNew(){
                this.news = {}
                this.Createing = true
            },
            Update(idx,row){
                this.select = row
                this.Updateing = true
            },
            QueryData(){
                let that=this
                myhttps("/Callback/get",{}).then(res=>{
                    that.dataList = res.body

                }).catch(res=>{
                    that.$message.error("错误："+res.msg)
                })
            }
        },
        mounted(){
            this.QueryData()
        }
    })

</script>
</html>
